var express = require('express');
var mongoose = require('mongoose');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
var session = require('express-session');

var task = require('./routers/task.js');
var user = require('./routers/user.js');

var dbUrl = "mongodb://127.0.0.1/task";
mongoose.connect(dbUrl);
console.log("db is connected");

var app = express();

var port = 9003;
app.listen(port);
console.log("Server is started on port:" + port);

app.use(bodyParser());
app.use(cookieParser());

app.use(session({
    secret: "task"
}));

app.use("/task", task);
app.use("/user", user);

